home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
misc
/
amag
/
am9305d.lha
/
EGS.lha
/
EGS
/
EGS_Devels
/
Examples
/
Other
/
star.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-18
|
3KB
|
102 lines
/* star.c
**
** FM - 12.08.92
**
** Renders a colour flow in the shape of a star by using lines
**
**
** (c) by VIONA-Development 1992/93
**
*/
#include <exec/types.h>
#include <proto/exec.h>
#include <egs/egsintui.h>
#include <egs/proto/egsintui.h>
#include <egs/egsgfx.h>
#include <egs/proto/egsgfx.h>
#include <egs/egs.h>
#include <egs/proto/egs.h>
/* the pointers to our libraries */
struct Library *EGSIntuiBase;
struct Library *EGSGfxBase;
struct Library *EGSBase;
/* Rendering of a regular star with four spikes */
void drawStar8( EG_RastPortPtr rp, long mx, long my, long h1, long h2 )
{
EG_AreaMove( rp, mx, my-h1 );
EG_AreaDraw( rp, mx+h2, my-h2 );
EG_AreaDraw( rp, mx+h1, my );
EG_AreaDraw( rp, mx+h2, my+h2 );
EG_AreaDraw( rp, mx, my+h1 );
EG_AreaDraw( rp, mx-h2, my+h2 );
EG_AreaDraw( rp, mx-h1, my );
EG_AreaDraw( rp, mx-h2, my-h2 );
EG_AreaEnd( rp );
}
/* something's happening here */
#define MAX_SIZE 100
void doThings( EI_WindowPtr window )
{
long size;
for( size=MAX_SIZE; size>1; size-- )
{
EG_SetAPen( window->RPort, ((255*size)/MAX_SIZE)*0x1010000 + 0x0000ff00 );
drawStar8( window->RPort, window->Width/2,window->Height/2, MAX_SIZE,size );
}
WaitPort( window->UserPort );
}
/* main program */
void main( int argc, char *argv[] )
{
static struct EI_NewWindow newWindow =
{
50,30, 400,300,
0,0, 0,0,
NULL,
EI_WINDOWCLOSE | EI_WINDOWBACK | EI_WINDOWDRAG,
NULL,
"Testfenster",
EI_SMART_REFRESH,
EI_iCLOSEWINDOW,
NULL,
{0,0,0,0,0,0,0},
NULL,
NULL
};
EI_WindowPtr window;
/* open libraries */
EGSIntuiBase = OpenLibrary( (UBYTE *)"egsintui.library", 0 );
if ( EGSIntuiBase )
{
EGSGfxBase = OpenLibrary( (UBYTE *)"egsgfx.library", 0 );
if ( EGSGfxBase )
{
EGSBase = OpenLibrary( (UBYTE *)"egs.library", 0 );
if ( EGSBase )
{
window = EI_OpenWindow( &newWindow );
if ( window )
{
doThings( window );
EI_CloseWindow( window );
}
CloseLibrary( EGSBase );
}
CloseLibrary( EGSGfxBase );
}
CloseLibrary( EGSIntuiBase );
}
}